import { Entity, Column, PrimaryGeneratedColumn, CreateDateColumn, UpdateDateColumn, BaseEntity } from 'typeorm';
// import * as dateFns from 'date-fns'
// import { UserAccount } from './user_account'

//订单表
export enum GenderEnum {
    MALE = 0,
    FEMAL = 1
}

export enum LendEnum {
    ONE = 1,//1万,
    THREE = 2,//3万,
    FIVE = 3,//5万,
    TEN = 4,//10万,
    FIFTY = 5,// 15万,
    TENTY = 6,// 20万,
    THRITY = 7,// 30万,
    MORE = 8,//更多
}

export enum LendTimeLimitEnum {
    DEFAULT = 0,//未知
    THREE = 3,
    SIX = 6,
    ONEYEAR = 12,
    ENGHTEEN = 18,
    TWOYEAR = 24,
    THREEYEAR = 36
}

export enum LendPurposeEnum {
    UNKNOW = 0,//未知
    ZHUANGXIU = 1,//'装修',
    JIAOYU = 2,//'教育',
    MAICHE = 3,// '买车',
    MAIFANG = 4,// '买房',
    JIUYI = 5,// '就医',
    OTHER = 6,//'其他用途'
}

export enum EducationEnum {
    UNKNOW = 0,//未知
    PRIMARY = 1,//小学
    MIDDLE = 2,//初中
    HIGH = 3,//高中
    UNIVERSITY = 4,//大学本科
    MORE = 5,//研究生及以上
}

export enum IncomeEnum {
    UNKNOW = 0,//未知
    THREE = 1,//0-3000
    FIVE = 2,//3000-5000
    ENGHT = 3,//5k-8k
    THETHOUSAND = 4,//8K-10K
    MORE = 5,//10k以上
}

export enum IncomeTypeEnum {
    UNKNOW = 0,//未知
    CASH = 1,//现金发放
    BANKCARD = 2,//银行卡发放
    OTHER = 3,//其他
}

export enum SocialInsuranceEnum {
    NO = 0,//无
    UNDERSIXMONTH = 1,//连续缴纳6个月以下
    OVERSIXMONTH = 2,//连续缴纳6个月以上
}

export enum AccumulationFundEnum {
    NO = 0,//无
    UNDERSIXMONTH = 1,//6个月以下
    OVERSIXMONTH = 2,//6个月以上
}

export enum WorkYearEnum {
    UNKNOW = 0,//未知
    UNDERSIXMONTH = 1,//6个月以下
    OVERSIXMONTH = 2,//6个月以上
}

export enum CreditCardLevelEnum {
    NO = 0,//无信用卡
    UNDERTENTHOUSAND = 1,//1万以下
    OVERTENTHOUSAND = 2,//1万以上
}

export enum WEILIDAIEnum {
    NO = 0,//无额度
    UNDERTENTHOUSAND = 1,//1万以下额度
    OVERTENTHOUSAND = 2,//1万以上额度
}

export enum HouseEnum {
    NO = 0,//无房产
    HAVE = 1,//有房产
}

export enum CarEnum {
    NO = 0,//无车产
    HAVE = 1,//有车产
}

export enum OrderStatusEnum {
    NOFINISH = 0,//未完成
    NORMAL = 1,//已填写完成
    PAID = 2,//已有人付款买断
    SELFPAID = 3,//自己买断，只返回给前端，数据库不会存在的
}


@Entity('order')
// export class Order {
export class Order extends BaseEntity {

    @PrimaryGeneratedColumn()
    order_id: number;

    @Column({
        width: 10,
        default: 10,
        comment: "价值羿币"
    })
    worth: number;

    @Column({
        width: 10,
        default: 0,
        comment: "用户id"
    })
    user_id: number;

    // @OneToOne(type => UserAccount)
    // @JoinColumn()
    // userAccount: UserAccount;

    @Column({
        length: 20,
        default: '',
        comment: "姓名"
    })
    name: string;

    @Column({
        length: 20,
        default: '',
        comment: "微信号"
    })
    wxname: string;

    @Column({
        type: "tinyint",
        default: GenderEnum.MALE,
        comment: "性别"
    })
    gender: number;

    @Column({
        width: 10,
        default: LendEnum.ONE,
        comment: "借款额度"
    })
    lend: number;

    @Column({
        length: 20,
        comment: "所在城市"
    })
    city: string;

    @Column({
        width: 10,
        type: "int",
        default: LendTimeLimitEnum.DEFAULT,
        comment: "借款期限"
    })
    time_limit: number;

    @Column({
        width: 10,
        type: "int",
        default: LendPurposeEnum.UNKNOW,
        comment: "借款目的，0是未知，1是装修，2是教育，3是买车，4买房，5就医，6其他"
    })
    purpose: number;

    @Column({
        length: 20,
        comment: "手机号码"
    })
    mobile: string;

    @Column({
        width: 10,
        type: "int",
        default: EducationEnum.UNKNOW,
        comment: "学历"
    })
    education: number;

    @Column({
        width: 10,
        type: "int",
        default: IncomeEnum.UNKNOW,
        comment: "月薪收入"
    })
    income: number;

    @Column({
        width: 10,
        type: "int",
        default: IncomeTypeEnum.UNKNOW,
        comment: "收入类型"
    })
    income_type: number;

    @Column({
        width: 10,
        type: "int",
        default: SocialInsuranceEnum.NO,
        comment: "社保"
    })
    social_insurance: number;

    @Column({
        width: 10,
        type: "int",
        default: AccumulationFundEnum.NO,
        comment: "公积金"
    })
    accumulation_fund: number;

    @Column({
        width: 10,
        type: "int",
        default: WorkYearEnum.UNKNOW,
        comment: "当前单位工龄"
    })
    work_year: number;

    @Column({
        width: 10,
        type: "int",
        default: CreditCardLevelEnum.NO,
        comment: "信用卡额度等级"
    })
    credit_card_level: number;

    @Column({
        width: 10,
        type: "int",
        default: WEILIDAIEnum.NO,
        comment: "微粒贷"
    })
    weilidai: number;

    @Column({
        width: 10,
        type: "int",
        default: HouseEnum.NO,
        comment: "名下房产"
    })
    house: number;

    @Column({
        width: 10,
        type: "int",
        default: CarEnum.NO,
        comment: "名下车产"
    })
    car: number;

    @Column({
        width: 10,
        type: "int",
        default: OrderStatusEnum.NOFINISH,
        comment: "订单状态"
    })
    status: number;

    @CreateDateColumn({
        comment: "创建时间"
    })
    create_time: Date;

    @UpdateDateColumn({
        comment: "更新时间"
    })
    update_time: Date;

}